<!-- 优惠券兑换 -->
<template>
	<view class="conversion">
		<view class="goods">
			<orderCard :list="list" @total="total" :show="true"></orderCard>
		</view>
		<!-- 商品积分 -->
		<view class="score">
			<view class="name">商品总积分</view>
			<view class="num">{{cart.sum}}积分</view>
		</view>
		<!-- 购买须知 -->
		<view class="buy">
			<view class="title">购买须知</view>
			<view class="bug_list" v-for="(item,index) in buys" :key="item.id">
				<view class="name">{{item.name}}</view>
				<view class="date">{{item.start_date}} 至 {{item.end_date}} </view>
			</view>
		</view>
		<goods-tabs :data= "cart"></goods-tabs>
	</view>
</template>
<script>
	import orderCard from 'pages/seller/components/order-card.vue'
	export default {
		components:{
			orderCard
		},
		data() {
			return {
				
				cart: {
					show: true,			// 是否显示应付：字眼
					integral: 1,            // 积分
					theme_btn: '确认兑换',          // 立即兑换按钮
					btn: '',                // 加入购物车
					type: false             ,// 是否显示灰色
					sum: 0,
				},
				//购买须知
				buys: [
					{
					id: 0,
					name:"有效期",
					start_date: "2020-12-18",
					end_date: "2021-12-18"
				},{id: 1,
					name:"支付说明",
					start_date: "2020-12-18",
					end_date: "2021-12-18"
				},{id: 2,
					name:"优惠细则",
					start_date: "2020-12-18",
					end_date: "2021-12-18"
				},
				],
				list: {
					name: '',
					checked: false, // Checkbox 是否被选中
					show: false, // swipeAction打开或者关闭某个组件
					value: 0, // 当前步进器的值，默认为1
					img: '/static/img/1.png',
					title: "周一特惠 10元代金券10元代金",
					integral: 8800,
					price: 100000,
					num: 100000,
				},
			};
		},
		mounted() {
		},
		watch: {
			cart: {
				  cart(val, oldVal){
						console.log("b.c: "+val.sum, oldVal.sum);
					},
					deep:true
			},
			cart(val, oldVal){//普通的watch监听
				console.log("a: "+val, oldVal);
			},
		},
		methods: {
			total(val) {
				this.cart.sum = this.cart.integral
				this.cart.sum = val * this.cart.integral
			}
		}

	};
</script>

<style scoped lang="scss">
	@import './index.scss';
</style>
